import cv2 as cv
import sys
import os
from python_ai.common.xcommon import *
import matplotlib.pyplot as plt
import numpy as np
import time

path = '../../../../large_data/video/ac2_CG/opening.wmv'

cap = cv.VideoCapture(path)

FPS = 25
interval = 1000 // FPS
while cap.isOpened():
    ret, frame = cap.read()

    if not ret:
        print('Cannot receive frame, exiting...')
        break

    cv.imshow('Video ' + os.path.split(path)[1], frame)
    k = cv.waitKey(1)
    if k == ord('q') or k == ord('Q') or k == 27:  # ATTENTION ESC=27
        print('Quit')
        break

cap.release()
cv.destroyAllWindows()
